bitkeeper revision 1.1031 (40e1d02b7TWzZP0WaSOhCDygYQPX4w)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 29 Jun 2004 20:25:15 +0000 (20:25 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 29 Jun 2004 20:25:15 +0000 (20:25 +0000)
Tool cleanups.

BitKeeper/etc/ignore
tools/libxc/Makefile
tools/libxutil/Makefile
tools/python/setup.py
tools/python/xen/ext/xc/xc.c
tools/xentrace/Makefile

index a45244fe007b621eaefb044c59a6ccedab295997..88f12111837f840bc8f974bd1ae7021c82cef60b 100644 (file)
@@ -1,4 +1,5 @@
 *.a
+*.d
 *.o
 *.pyc
 *.so
@@ -17,29 +18,8 @@ linux-2.4.26-xen/*
 linux-xen-sparse
 patches/*
 tools/*/build/lib*/*.py
-tools/balloon/balloon
 tools/misc/miniterm/miniterm
 tools/misc/xen_cpuperf
-tools/misc/xen_log
-tools/misc/xen_read_console
-tools/xc/lib/.allocate.o.d
-tools/xc/lib/.file_stream.o.d
-tools/xc/lib/.gzip_stream.o.d
-tools/xc/lib/.iostream.o.d
-tools/xc/lib/.sys_net.o.d
-tools/xc/lib/.sys_string.o.d
-tools/xc/lib/.xc_atropos.o.d
-tools/xc/lib/.xc_bvtsched.o.d
-tools/xc/lib/.xc_domain.o.d
-tools/xc/lib/.xc_evtchn.o.d
-tools/xc/lib/.xc_io.o.d
-tools/xc/lib/.xc_linux_build.o.d
-tools/xc/lib/.xc_linux_restore.o.d
-tools/xc/lib/.xc_linux_save.o.d
-tools/xc/lib/.xc_misc.o.d
-tools/xc/lib/.xc_netbsd_build.o.d
-tools/xc/lib/.xc_physdev.o.d
-tools/xc/lib/.xc_private.o.d
 tools/xentrace/xentrace
 xen/drivers/pci/classlist.h
 xen/drivers/pci/devlist.h
@@ -52,23 +32,3 @@ xen/tools/figlet/figlet
 xen/xen
 xen/xen-syms
 xen/xen.*
-tools/xc/lib/.xc_rrobin.o.d
-tools/libxc/.xc_atropos.o.d
-tools/libxc/.xc_bvtsched.o.d
-tools/libxc/.xc_domain.o.d
-tools/libxc/.xc_evtchn.o.d
-tools/libxc/.xc_io.o.d
-tools/libxc/.xc_linux_build.o.d
-tools/libxc/.xc_linux_restore.o.d
-tools/libxc/.xc_linux_save.o.d
-tools/libxc/.xc_misc.o.d
-tools/libxc/.xc_netbsd_build.o.d
-tools/libxc/.xc_physdev.o.d
-tools/libxc/.xc_private.o.d
-tools/libxc/.xc_rrobin.o.d
-tools/libxutil/.allocate.o.d
-tools/libxutil/.file_stream.o.d
-tools/libxutil/.gzip_stream.o.d
-tools/libxutil/.iostream.o.d
-tools/libxutil/.sys_net.o.d
-tools/libxutil/.sys_string.o.d
index 8db55c2028e9ae2751de8a9237aad52d427d48db..bf81b86c6d297f236a30cf0996c17e38204676f2 100644 (file)
@@ -20,26 +20,6 @@ INCLUDES += -I $(XEN_XU)
 vpath %c       $(XEN_LIBXUTIL)
 INCLUDES += -I $(XEN_LIBXUTIL)
 
-LIB_SRCS :=
-LIB_SRCS += allocate.c
-#LIB_SRCS += enum.c
-LIB_SRCS += file_stream.c
-LIB_SRCS += gzip_stream.c
-#LIB_SRCS += hash_table.c
-LIB_SRCS += iostream.c
-#LIB_SRCS += kernel_stream.c
-#LIB_SRCS += lexis.c
-#LIB_SRCS += lzi_stream.c
-#LIB_SRCS += lzo_stream.c
-#LIB_SRCS += marshal.c
-#LIB_SRCS += socket_stream.c
-#LIB_SRCS += string_stream.c
-#LIB_SRCS += sxpr.c
-#LIB_SRCS += sxpr_parser.c
-LIB_SRCS += sys_net.c
-LIB_SRCS += sys_string.c
-#LIB_SRCS += xdr.c
-
 SRCS     :=
 SRCS     += xc_atropos.c
 SRCS     += xc_bvtsched.c
@@ -55,11 +35,8 @@ SRCS     += xc_physdev.c
 SRCS     += xc_private.c
 SRCS     += xc_rrobin.c
 
-#SRCS     += $(LIB_SRCS)
-
 CFLAGS   += -Wall
 CFLAGS   += -Werror
-CFLAGS   += -g
 CFLAGS   += -O3
 CFLAGS   += -fno-strict-aliasing
 CFLAGS   += $(INCLUDES)
@@ -106,10 +83,6 @@ libxc.so:
 libxc.so.$(MAJOR):
        ln -sf libxc.so.$(MAJOR).$(MINOR) $@
 libxc.so.$(MAJOR).$(MINOR): $(OBJS)
-       $(CC) -Wl,-soname -Wl,$(SONAME) -shared -o $@ $^ ../libxutil/libxutil.a -lz 
-
-%.o: %.c Makefile
-
-#      $(CC) $(CFLAGS) -o $@ $<
+       $(CC) -Wl,-soname -Wl,$(SONAME) -shared -o $@ $^ -L../libxutil -lxutil -lz
 
 -include $(DEPS)
index 0e92fa771fe6344664a05c8283f8ab5199d4204c..9c59bc5be276ca9e65ffdf088841d24de3483951 100644 (file)
@@ -5,23 +5,11 @@ CC = gcc
 
 LIB_SRCS :=
 LIB_SRCS += allocate.c
-#LIB_SRCS += enum.c
 LIB_SRCS += file_stream.c
 LIB_SRCS += gzip_stream.c
-#LIB_SRCS += hash_table.c
 LIB_SRCS += iostream.c
-#LIB_SRCS += kernel_stream.c
-#LIB_SRCS += lexis.c
-#LIB_SRCS += lzi_stream.c
-#LIB_SRCS += lzo_stream.c
-#LIB_SRCS += marshal.c
-#LIB_SRCS += socket_stream.c
-#LIB_SRCS += string_stream.c
-#LIB_SRCS += sxpr.c
-#LIB_SRCS += sxpr_parser.c
 LIB_SRCS += sys_net.c
 LIB_SRCS += sys_string.c
-#LIB_SRCS += xdr.c
 
 LIB_OBJS := $(LIB_SRCS:.c=.o)
 
@@ -30,32 +18,28 @@ CFLAGS   += -Werror
 CFLAGS   += -g
 CFLAGS   += -O3
 CFLAGS   += -fno-strict-aliasing
-#CFLAGS   += $(INCLUDES)
+
 # Get gcc to generate the dependencies for us.
 CFLAGS   += -Wp,-MD,.$(@F).d
 DEPS     = .*.d
 
-MAJOR    = 1.3
-MINOR    = 0
-LIB_NAME = libxutil
-LIB_BASE = $(LIB_NAME).so
-LIB_MAJOR= $(LIB_BASE).$(MAJOR)
-LIB_MINOR= $(LIB_MAJOR).$(MINOR)
-LIB      = $(LIB_BASE) $(LIB_MAJOR) $(LIB_MINOR) $(LIB_NAME).a
+MAJOR    := 1.3
+MINOR    := 0
+LIB_NAME := libxutil
+LIB      := $(LIB_NAME).so 
+LIB      += $(LIB_NAME).so.$(MAJOR)
+LIB      += $(LIB_NAME).so.$(MAJOR).$(MINOR)
 
 all: check-for-zlib $(LIB)
 
-$(LIB_BASE):
-       ln -sf $(LIB_MAJOR) $@
-
-$(LIB_MAJOR):
-       ln -sf $(LIB_MINOR) $@
+$(LIB_NAME).so:
+       ln -sf $(LIB_NAME).so.$(MAJOR) $@
 
-$(LIB_MINOR): $(LIB_OBJS)
-       $(CC) -Wl,-soname -Wl,$(LIB_MAJOR) -shared -o $@ $^
+$(LIB_NAME).so.$(MAJOR):
+       ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $@
 
-$(LIB_NAME).a: $(LIB_OBJS)
-       $(AR) rc $@ $^
+$(LIB_NAME).so.$(MAJOR).$(MINOR): $(LIB_OBJS)
+       $(CC) -Wl,-soname -Wl,$(LIB_NAME).so.$(MAJOR) -shared -o $@ $^
 
 check-for-zlib:
        @if [ ! -e /usr/include/zlib.h ]; then \
@@ -69,8 +53,7 @@ install: all
        mkdir -p $(prefix)/usr/lib
        mkdir -p $(prefix)/usr/include
        install -m0755 $(LIB) $(prefix)/usr/lib
-
-#install -m0644 xc.h $(prefix)/usr/include
+       install -m0644 xc.h $(prefix)/usr/include
 
 clean:
        $(RM) *.a *.so *.o *.rpm $(LIB)
index b0eb3f2ebd81aa91b520de57af0f3aea017986ae..0b8efce0fd71a67a686c21469e48ba2dd37b46cf 100644 (file)
@@ -3,7 +3,7 @@ from distutils.core import setup, Extension
 
 XEN_ROOT = "../.."
 
-extra_compile_args  = ["-fno-strict-aliasing"]
+extra_compile_args  = [ "-fno-strict-aliasing", "-Wall", "-Werror" ]
 
 
 include_dirs = [ XEN_ROOT + "/xen/include/hypervisor-ifs",
index 2eb70cf2a01dbf0b80a7ae5be075a117a19f7eac..ab045199e6cd9f4f3263e621d4281e95dcfe1cc5 100644 (file)
@@ -191,32 +191,42 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
     return list;
 }
 
-static int file_save(XcObject *xc, XcIOContext *ctxt, char *state_file){
+static int file_save(XcObject *xc, XcIOContext *ctxt, char *state_file)
+{
     int rc = -1;
     int fd = -1;
     int open_flags = (O_CREAT | O_EXCL | O_WRONLY);
     int open_mode = 0644;
 
     printf("%s>\n", __FUNCTION__);
-    fd = open(state_file, open_flags, open_mode);
-    if(fd < 0){
+
+    if ( (fd = open(state_file, open_flags, open_mode)) < 0 )
+    {
         xcio_perror(ctxt, "Could not open file for writing");
         goto exit;
     }
+
+    printf("%s>gzip_stream_fdopen... \n", __FUNCTION__);
+
     /* Compression rate 1: we want speed over compression. 
      * We're mainly going for those zero pages, after all.
      */
-    printf("%s>gzip_stream_fdopen... \n", __FUNCTION__);
     ctxt->io = gzip_stream_fdopen(fd, "wb1");
-    if(!ctxt->io){
+    if ( ctxt->io == NULL )
+    {
         xcio_perror(ctxt, "Could not allocate compression state");
         goto exit;
     }
+
     printf("%s> xc_linux_save...\n", __FUNCTION__);
+
     rc = xc_linux_save(xc->xc_handle, ctxt);
+
   exit:
-    if(ctxt->io) IOStream_close(ctxt->io);
-    if(fd >= 0) close(fd);
+    if ( ctxt->io != NULL )
+        IOStream_close(ctxt->io);
+    if ( fd >= 0 )
+        close(fd);
     unlink(state_file);
     printf("%s> rc=%d\n", __FUNCTION__, rc);
     return rc;
@@ -228,53 +238,62 @@ static PyObject *pyxc_linux_save(PyObject *self,
 {
     XcObject *xc = (XcObject *)self;
 
-    u32 dom;
     char *state_file;
     int progress = 1, debug = 0;
-    unsigned int flags = 0;
     PyObject *val = NULL;
     int rc = -1;
     XcIOContext ioctxt = { .info = iostdout, .err = iostderr };
 
     static char *kwd_list[] = { "dom", "state_file", "vmconfig", "progress", "debug", NULL };
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "is|sii", kwd_list, 
-                                     &ioctxt.domain,
-                                     &state_file,
-                                     &ioctxt.vmconfig,
-                                     &progress, 
-                                     &debug)){
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|sii", kwd_list, 
+                                      &ioctxt.domain,
+                                      &state_file,
+                                      &ioctxt.vmconfig,
+                                      &progress, 
+                                      &debug) )
         goto exit;
-    }
+
     ioctxt.vmconfig_n = (ioctxt.vmconfig ? strlen(ioctxt.vmconfig) : 0);
-    if (progress)  ioctxt.flags |= XCFLAGS_VERBOSE;
-    if (debug)     ioctxt.flags |= XCFLAGS_DEBUG;
-    if(!state_file || state_file[0] == '\0') goto exit;
+
+    if ( progress )
+        ioctxt.flags |= XCFLAGS_VERBOSE;
+    if ( debug )
+        ioctxt.flags |= XCFLAGS_DEBUG;
+
+    if ( (state_file == NULL) || (state_file[0] == '\0') )
+        goto exit;
+    
     rc = file_save(xc, &ioctxt, state_file);
-    if(rc){
+    if ( rc != 0 )
+    {
         PyErr_SetFromErrno(xc_error);
         goto exit;
     } 
-    //xc_domain_destroy(xc->xc_handle, dom);
+
     Py_INCREF(zero);
     val = zero;
+
   exit:
     return val;
 }
 
 
-static int file_restore(XcObject *xc, XcIOContext *ioctxt, char *state_file){
+static int file_restore(XcObject *xc, XcIOContext *ioctxt, char *state_file)
+{
     int rc = -1;
 
     ioctxt->io = gzip_stream_fopen(state_file, "rb");
-    if (!ioctxt->io) {
+    if ( ioctxt->io == NULL )
+    {
         xcio_perror(ioctxt, "Could not open file for reading");
-        goto exit;
+        return rc;
     }
 
     rc = xc_linux_restore(xc->xc_handle, ioctxt);
-  exit:
-    if(ioctxt->io) IOStream_close(ioctxt->io);
+
+    IOStream_close(ioctxt->io);
+    
     return rc;
 }
 
@@ -285,33 +304,38 @@ static PyObject *pyxc_linux_restore(PyObject *self,
     XcObject *xc = (XcObject *)self;
     char *state_file;
     int progress = 1, debug = 0;
-    u32 dom;
     PyObject *val = NULL;
     XcIOContext ioctxt = { .info = iostdout, .err = iostderr };
     int rc =-1;
 
     static char *kwd_list[] = { "state_file", "progress", "debug", NULL };
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "is|ii", kwd_list, 
-                                     &ioctxt.domain,
-                                     &state_file,
-                                     &progress,
-                                     &debug)){
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|ii", kwd_list,
+                                      &ioctxt.domain,
+                                      &state_file,
+                                      &progress,
+                                      &debug) )
+        goto exit;
+
+    if ( progress )
+        ioctxt.flags |= XCFLAGS_VERBOSE;
+    if ( debug )
+        ioctxt.flags |= XCFLAGS_DEBUG;
+
+    if ( (state_file == NULL) || (state_file[0] == '\0') )
         goto exit;
-    }
-    if (progress) ioctxt.flags |= XCFLAGS_VERBOSE;
-    if (debug)    ioctxt.flags |= XCFLAGS_DEBUG;
 
-    if(!state_file || state_file[0] == '\0') goto exit;
     rc = file_restore(xc, &ioctxt, state_file);
-    if(rc){
+    if ( rc != 0 )
+    {
         PyErr_SetFromErrno(xc_error);
         goto exit;
     }
+
     val = Py_BuildValue("{s:i,s:s}",
                         "dom", ioctxt.domain,
                         "vmconfig", ioctxt.vmconfig);
-    //? free(ioctxt.vmconfig);
+
   exit:
     return val;
 }
index fb90e2c1257a00d82bbd600b70dc2f398a41adfb..9590b5cffb750840b48cef15e6cd57e35c1e8a36 100644 (file)
@@ -3,7 +3,7 @@ XEN_ROOT=../..
 include $(XEN_ROOT)/tools/Make.defs
 
 CC       = gcc
-CFLAGS   = -Wall -O3 -Werror
+CFLAGS   = -Wall -Werror -O3
 
 CFLAGS  += -I $(XEN_HYPERVISOR_IFS)
 CFLAGS  += -I $(XEN_LINUX_INCLUDE)
@@ -34,4 +34,4 @@ clean:
        $(RM) *.a *.so *.o *.rpm $(BIN)
 
 %: %.c $(HDRS) Makefile
-       $(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxc
+       $(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -L$(XEN_LIBXUTIL) -lxc -lxutil